﻿#region Using declarations
using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    partial class Strategy
    {
        ///Converts calendar date to Julian date.
        ///Syntax: DateToJulian(cDate);
        ///cDate: numeric expression for the date in YYMMDD or YYYMMDD format.
        public int DateToJulian(int cDate)
        {
            DateTime userDate = new DateTime(NormalizeYear(Year(cDate)), Month(cDate), cDate % 100);
            DateTime date = new DateTime(1900, 1, 1);
            int julian = userDate.Subtract(date).Days + 2;
            return julian;
        }

    }
}
